//
//  ZJRootTranditionalTbleView.m
//  PersonalHospital
//
//  Created by qianfeng on 15/12/12.
//  Copyright (c) 2015年 QianFeng. All rights reserved.
//

#import "ZJRootTranditionalTbleView.h"
#import "TranditionalShowModel.h"
#import "TranditionalShowCell.h"
@interface ZJRootTranditionalTbleView ()

@end

@implementation ZJRootTranditionalTbleView

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
//    self.tableView.backgroundColor=[UIColor redColor];
    [self loadData];
}

-(NSMutableArray *)dataSource{
    if (_dataSource==nil) {
        _dataSource=[[NSMutableArray alloc]init];
    }
    return _dataSource;
}

-(AFHTTPRequestOperationManager *)manager{
    if (_manager==nil) {
        _manager=[AFHTTPRequestOperationManager manager];
        _manager.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"text/html",@"application/json", nil];
    }
    return _manager;
}

-(void)loadData{
    NSString * path=KTranditional_All_Path;
    [self loadDataWithPath:path];
}



-(void)loadDataWithPath:(NSString *)path{
    [self.manager GET:path parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        [self paseData:responseObject];
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
}

-(void)paseData:(id)responseObject{


}



#pragma mark - Table view data source

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataSource.count;
    
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    TranditionalShowCell * cell=[tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell==nil) {
        cell=[[TranditionalShowCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }

    cell.model=self.dataSource[indexPath.row];
    return cell;
}




-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return KTranditional_Scroll_Cell;
}

//#pragma mark --头视图
//
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//    if (section==1) {
//        return 44;
//    }
//    return 0;
//}
//-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//   
//        TranditionalShowModel * model=nil;
//        UIView * view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
//        
//        view.backgroundColor=[UIColor groupTableViewBackgroundColor];
//        
//        UILabel * name=[[UILabel alloc]init];
//        name.frame=CGRectMake((KScreen_Size.width-80)/2, 0, 80, view.frame.size.height);
//        name.textAlignment=NSTextAlignmentLeft;
//        name.textColor=[UIColor blackColor];
//        model=self.objectArray[0];
//        name.text=model.adultDiseaseName;
//        name.font=[UIFont systemFontOfSize:18];
//        
//        UILabel * right=[[UILabel alloc]init];
//        right.frame=CGRectMake((KScreen_Size.width-80), 0, 80,view.frame.size.height);
//        right.textAlignment=NSTextAlignmentLeft;
//        right.textColor=[UIColor blackColor];
//        right.text=@"更多 > >";
//        right.font=[UIFont systemFontOfSize:14];
//        [view addSubview:name];
//        [view addSubview:right];
//        return view;
//
//}


@end
